import request from '@/utils/request'

// 用户相关API
export const login = (data) => request.post('/api/user/login', data)
export const register = (data) => request.post('/api/user/register', data)
export const forgotPassword = (data) => request.post('/api/user/forgot', data)

// 论文相关API
export const uploadPaper = (formData) => request.post('/api/paper/upload', formData, {
  headers: { 'Content-Type': 'multipart/form-data' }
})

export const detectPaper = (paperId) => request.post(`/api/paper/detect/${paperId}`)

export const rewriteParagraph = (paperId, paragraphId, content = null) =>
  request.post('/api/paper/rewrite', { paperId, paragraphId, content })

export const getPaperList = (userId) => request.get(`/api/paper/list/${userId}`)

export const exportReport = (paperId) => request.get(`/api/paper/export/${paperId}`, {
  responseType: 'blob'
})

export const deletePaper = (paperId) => request.delete(`/api/paper/${paperId}`)

export const getDetectionChart = (paperId) => request.get(`/api/paper/chart/${paperId}`)